
#include "orangepch.h"

#include "OpenGLContext.h"


namespace Orange {
	OpenGlContext::OpenGlContext(GLFWwindow* windowHandle):m_windowHandle(windowHandle)
	{
	}

	void OpenGlContext::Init()
	{
		glfwMakeContextCurrent(m_windowHandle);
		int status = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);

		ORANGE_CORE_ASSERT(status, "Could not intialize GLAD!");


		ORANGE_INFO("Opengl info:");
		ORANGE_INFO("vendor: {0}",glGetString(GL_VENDOR));
		ORANGE_INFO("renderer: {0}",glGetString(GL_RENDERER));
		ORANGE_INFO("version: {0}",glGetString(GL_VERSION));
	}

	void OpenGlContext::SwapBuffers()
	{
		glfwSwapBuffers(m_windowHandle);
	}

}